<template>
    <div>
            <!-- <a><img src="./古风s.jpg"></a> -->
游戏展示
        <div>
            <table class="b">              
                <tr>
                    <td>ID</td>
                    <td>游戏名称</td>
                    <td>操作</td>
                </tr>
                <tr v-for="(i,j) in yxlist" :key="j">
                    <td>{{ i.id }}</td>
                    <td>{{ i.yxname }}</td>
                    <td>
                        <input type="button" value="删除" @click="delX(i.id)"/> 
                        <input type="button" value="修改" @click="updatex(i.id)">
                    </td>
                </tr>
            </table>
            <!-- <div class="pagenation">
  				<a>上一页</a>
  				<a></a>
  				<a>下一页></a>
  			</div> -->
        </div>
英雄展示
        <div>
            <table class="b" >
                <tr class="c">
                    <td>ID</td>
                    <td>英雄名称</td>
                    <td>密码</td>
                    <td>所在游戏</td>
                    <td>头像</td>
                    <td>操作</td>
                </tr>
                <tr v-for="(x,y) in yylist" :key="y">
                    <td>{{ x.id }}</td>
                    <td>{{ x.usernmae }}</td>
                    <td>{{ x.password }}</td>
                    <td>{{ x.yxres }}</td>
                    <td>{{ x.img }}</td>
                    <td>
                        <input type="button" value="删除" @click="dely(x.id)"/> 
                        <input type="button" value="修改" @click="updatey(x.usernmae)">
                    </td>
                </tr>
            </table>
            <!-- <div>
                <a  @click="pageclick(page_data.page_num_prev)">上一页</a>
  				<a  v-for="(num,index) in page_data.page_num_list" :key="index" @click="pageclick(num)">{{num}}</a>
  				<a  @click="pageclick(page_data.page_num_next)">下一页></a>
            </div> -->
        </div>
    </div>
</template>

<script>
import { RI_res_yxsh } from '../axios_send/api.js'
import { RI_us_show } from '../axios_send/api.js'
import axios from 'axios'
export default {
    name:"yshow",
    data(){
        return{
            yxlist:"",
            yylist:"",
        }
    },
    created(){
        this.yxsw()
        this.yssw()

    },
    methods:{
        yxsw(){
            RI_res_yxsh()
            .then(res=>{
                console.log(res)
                this.yxlist=res
            })
        },
        yssw(){
            RI_us_show()
            .then(res=>{
                console.log(res)
                this.yylist=res
            })
        },
        delX(id){
            axios({
                url:"http://127.0.0.1:8000/zks/yxdel/",
                method:"get",
                params:{"id":id},
            })
            .then(res=>{
                console.log(res);     
            })
        },
        dely(id){
            console.log(id);
            
            axios({
                url:"http://127.0.0.1:8000/zks/usdel/",
                method:"get",
                params:{"id":id},
            })
            .then(res=>{
                console.log(res);     
            })
        },
        updatex(id){
            this.$router.push({name:"upss",params:{"id":id}})
        },
        updatey(usernmae){
            this.$router.push({name:"upss",params:{"usernmae":usernmae}})
        }
    }
}
</script>

<style>
    .a{height: 200px;}
    .b{ border: 1px; height:200px; width: 360px; margin:auto}
</style>
